<!DOCTYPE html>
<html>
<head>
    <title>库存管理系统</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        .container {
            max-width: 600px;
            margin: auto;
            text-align: center;
        }
        .button {
            display: inline-block;
            margin: 10px;
            padding: 10px 20px;
            background-color: #007BFF;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            max-width: 140px; /* 设置最大宽度 */
            width: 100%; /* 占满可用空间 */
            text-align: center; /* 文本居中 */
        }
        .button:hover {
            background-color: #0056b3;
        }
        .login-button {
            width: 60px; /* 设置登录按钮的宽度 */
        }
        .topbar {
            background-color: #f8f9fa;
            padding: 0px;
            text-align: right;
        }
    </style>
</head>
<body>
    <div class="topbar">
        {% if current_user.is_authenticated %}
            <p>欢迎，<strong>{{ current_user.username }}</strong>！<a href="{{ url_for('logout') }}" class="button login-button">登出</a></p>
        {% else %}
            <a href="{{ url_for('login') }}" class="button login-button">登录</a>
        {% endif %}
    </div>
    <div class="container">
        <h1>欢迎使用库存管理系统</h1>
        <div class="button-row">
            <a href="{{ url_for('sales_products') }}" class="button">产品销售</a>
            <a href="{{ url_for('add_product') }}" class="button">添加新产品</a>
            <a href="{{ url_for('list_products') }}" class="button">查看产品列表</a>
            <a href="{{ url_for('list_sales') }}" class="button">查看销售记录</a>
            <a href="{{ url_for('list_purchases') }}" class="button">查看采购记录</a>
            <a href="{{ url_for('cash_records') }}" class="button">查看现金</a>
        </div>
        <div class="button-row">
            <a href="{{ url_for('add_income') }}" class="button">其他收入</a>
            <a href="{{ url_for('add_expense') }}" class="button">其他支出</a>
            <a href="{{ url_for('inventory') }}" class="button">查看库存</a>
            <a href="{{ url_for('statistics') }}" class="button">统计报表</a>
            <a href="{{ url_for('list_customers') }}" class="button">客户列表</a>
            <a href="{{ url_for('list_suppliers') }}" class="button">供应商列表</a>
        </div>
    </div>
</body>
</html>